package job.kedaxunfei;

import java.util.Scanner;

/**
 * @author wq
 * 矩阵相交
 * 使用对角线相连的两个点表示一个矩形，如矩形(0,0),(2,1)表示(0,0),(2,0),(2,1)(0,1)所围成的矩形区域。  编程实现判断输入的两个矩形是否相交
 */
public class RectIntersect {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int[] rec1=new int[4];
        int[] rec2=new int[4];
        for(int i=0;i<4;i++){
            rec1[i]=scanner.nextInt();
        }
        for (int i=0;i<4;i++){
            rec2[i]=scanner.nextInt();
        }

        boolean res=isRectangleOverlap(rec1,rec2);
        System.out.println(res);
    }
    public static boolean isRectangleOverlap(int[] rec1,int[] rec2){
        int Lx = Math.abs((rec1[0] + rec1[2])/2 - (rec2[0] + rec2[2])/2);
        int Ly = Math.abs((rec1[1] + rec1[3])/2 - (rec2[1] + rec2[3])/2);

        int Sx1 = Math.abs(rec1[0] - rec1[2]);
        int Sx2 = Math.abs(rec2[0] - rec2[2]);
        int Sy1 = Math.abs(rec1[1] - rec1[3]);
        int Sy2 = Math.abs(rec2[1] - rec2[3]);
        return Lx <= (Sx1 + Sx2)/2 && Ly <= (Sy1 + Sy2)/2;
    }
}
